package com.CI.DeleteAccount.Business
{
	import com.CI.DeleteAccount.VO.AccountEternalVO;
	import com.CI.DeleteAccount.VO.AccountTemporaryVO;
	import com.adobe.cairngorm.business.Responder;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.http.HTTPService;
	
	public class DeleteDelegate
	{
		protected var responder : Responder;
		
		public function DeleteDelegate(responder : Responder)
		{
			this.responder = responder;
		}
		
		public function sendObject(obj : Object) : void
		{   
			var params : Object = new Object();
			var service : HTTPService;
			var token : AsyncToken;
			var responder : mx.rpc.Responder;
		
		    if(obj is AccountTemporaryVO)
		    {   
		    	var accTempo : AccountTemporaryVO = new AccountTemporaryVO();
		    	accTempo = obj as AccountTemporaryVO;
		    	
		    	params.action = 'deleteTemporary';
		    	params.email = accTempo.email;
		    	
		    	service = ServiceLocator.getInstance().getHTTPService("deleteTemporary");
		    	
		    	token = service.send(params);
				responder = new mx.rpc.Responder(Add_onResult, Add_onFault);
				token.addResponder(responder);
		    }
		    else
		    {
		    	var accEter : AccountEternalVO = new AccountEternalVO();
		    	accEter = obj as AccountEternalVO;
		    	
		    	params.action = 'deleteEternal';
		    	params.email = accEter.email;
		    	
		    	service = ServiceLocator.getInstance().getHTTPService("deleteEternal");
		    	
		    	token = service.send(params);
				responder = new mx.rpc.Responder(Add_onResult, Add_onFault);
				token.addResponder(responder);
		    }
		}
		
		protected function Add_onResult(event:ResultEvent) : void
		{
			
		}
		
		protected function Add_onFault(event:FaultEvent) : void
		{
		
		}
	}
}